package com.own.component.util.excel.util.write.style.item;

import com.own.component.util.excel.util.write.style.base.AbstractStyleFunction;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment;

/**
 * StyleItemHorizontalAlignment
 * <p>
 * 水平位置
 *
 * @author chenxueli
 * @date 2023-05-11 15:46:00
 */
public class StyleItemHorizontalAlignment extends AbstractStyleFunction<HorizontalAlignment> {

    public static final StyleItemHorizontalAlignment GENERAL = new StyleItemHorizontalAlignment(HorizontalAlignment.GENERAL);
    public static final StyleItemHorizontalAlignment LEFT = new StyleItemHorizontalAlignment(HorizontalAlignment.LEFT);
    public static final StyleItemHorizontalAlignment CENTER = new StyleItemHorizontalAlignment(HorizontalAlignment.CENTER);
    public static final StyleItemHorizontalAlignment RIGHT = new StyleItemHorizontalAlignment(HorizontalAlignment.RIGHT);
    public static final StyleItemHorizontalAlignment FILL = new StyleItemHorizontalAlignment(HorizontalAlignment.FILL);
    public static final StyleItemHorizontalAlignment JUSTIFY = new StyleItemHorizontalAlignment(HorizontalAlignment.JUSTIFY);
    public static final StyleItemHorizontalAlignment CENTER_SELECTION = new StyleItemHorizontalAlignment(HorizontalAlignment.CENTER_SELECTION);
    public static final StyleItemHorizontalAlignment DISTRIBUTED = new StyleItemHorizontalAlignment(HorizontalAlignment.DISTRIBUTED);

    private StyleItemHorizontalAlignment(HorizontalAlignment item) {
        super(item);
    }

    /**
     * 使用样式
     *
     * @param style 样式
     */
    @Override
    public void apply(CellStyle style) {
        style.setAlignment(super.getItem());
    }

}
